#ifndef FRUSTUM_H
#define FRUSTUM_H

#include "BasicMath.h"
#include <math.h>
#include "Matrix4.hpp"

class Frustum {
private:
	static Matrix4 Ppersp;

public:
	static void genPpersp(double fov, double aspect, double near, double far) {
		fov = BasicMath::radian(fov);
		Ppersp.set(
			1/(aspect*tan(fov/2)), 0, 0, 0,
			0, 1/tan(fov/2), 0, 0,
			0, 0, (near+far)/(near-far), -1,
			0, 0, 2*near*far/(near-far), 0);
	}
	static void setGlProj() {
		  glMatrixMode(GL_PROJECTION);
		  glLoadMatrixd(Ppersp.getPointer());
		  glMatrixMode(GL_MODELVIEW);
	}
};

Matrix4 Frustum::Ppersp = Matrix4();

#endif